
var app = getApp()

Page({
  data: {
    paymodalHidden: true,
    isPopping: true,      //右下角是否已经弹出
  },
  onLoad: function () {
    
  },
  plus: function () {   //右下角点击弹出
    if (this.data.isPopping) {
      //缩回动画
      this.takeback()
      setTimeout(() => {
        this.setData({
          isPopping: false,
          is_hidden: true
        })
      }, 500)
    } else if (!this.data.isPopping) {
      //弹出动画
      this.setData({
        isPopping: true,
        is_hidden: false
      })
      this.popp()
    }
  },
  popp: function () {   //弹出动画
    //plus顺时针旋转
    var animationPlus = wx.createAnimation({
      duration: 500,
      timingFunction: 'ease-out'
    })
    var animationWxservice = wx.createAnimation({
      duration: 500,
      timingFunction: 'ease-out'
    })
    animationPlus.rotateZ(90).step();       //PLUS旋转90°
    animationWxservice.opacity(1).step()    //item逐渐显示
    this.setData({
      animPlus: animationPlus.export(),
      animWxservice: animationWxservice.export(),
    })
  },
  takeback: function () {   //收回动画
    //plus逆时针旋转
    
    var animationPlus = wx.createAnimation({
      duration: 500,
      timingFunction: 'ease-out'
    })
    var animationWxservice = wx.createAnimation({
      duration: 500,
      timingFunction: 'ease-out'
    })
    animationPlus.rotateZ(0).step()
    animationWxservice.translate(0, 0).rotateZ(0).opacity(0).step()
    console.log(123)
    this.setData({
      animPlus: animationPlus.export(),
      animWxservice: animationWxservice.export(),
    })
  },
  show_pay_modal: function () {   //点击显示支付模态框
    this.setData({
      paymodalHidden: false
    })
  },
  paymodalCancel: function () {   //模态框点击取消
    this.setData({
      paymodalHidden: true
    })
  },
  paymodalConfirm: function () {    //模态框点击确认
    this.setData({
      paymodalHidden: true
    })
  },
  previewpayImage: function (e) {   //点击赞赏图片浏览保存
    var current = e.target.dataset.src;
    wx.previewImage({
      current: current,     // 当前显示图片的http链接
      urls: ['https://gss0.baidu.com/-Po3dSag_xI4khGko9WTAnF6hhy/zhidao/pic/item/43a7d933c895d143fee15a247ef082025aaf0725.jpg'] // 需要预览的图片http链接列表
    })
  },
  onShareAppMessage: function () { //用户点击右上角分享   
    return {
      title: '篮子数据分享', // 分享标题
      desc: '篮子数据分享', // 分享描述
      path: 'pages/metro/metro' // 分享路径
    }
  },
})